import { getXzxq } from '@/api/houseResource'

const administrativeRegion = {
  state: {
    administrativeRegion: [] // 默认值记得变更
  },
  mutations: {
    setAdministrativeRegion (state, data) {
      state.administrativeRegion = data
    }
  },
  actions: {
    getAdministrativeRegion ({ commit }, data) {
      return new Promise((resolve, reject) => {
        try {
          getXzxq().then((res) => {
            commit('setAdministrativeRegion', res.data)
            resolve(res)
          }).catch(error => reject(error))
        } catch (error) {
          reject(error)
        }
      })
    }
  }
}
export default administrativeRegion
